Skip to content

Conversation

@sudo-shashank
Copy link
Contributor

@sudo-shashank sudo-shashank commented Jan 28, 2026

Summary of changes

Changes introduced in this pull request:

  • Impl Filecoin.EthGetStorageAt V2 and added test.

Reference issue to close (if applicable)

Closes #6301

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added Filecoin.EthGetStorageAt v2 API path with extended block parameter support.
  • Tests

    • Added RPC tests covering the V2 storage endpoint for current, safe, and finalized block references.
  • Documentation

    • Added changelog entry documenting the new V2 storage endpoint.

✏️ Tip: You can customize this high-level summary in your review settings.

@sudo-shashank sudo-shashank added the RPC requires calibnet RPC checks to run on CI label Jan 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

Adds a Filecoin.EthGetStorageAt V2 RPC method, extracts storage-retrieval logic into a shared async helper used by both V1 and V2, registers the new method in the RPC registry, and adds tests and snapshots for the V2 endpoint. No other public signatures changed.

Changes

Cohort / File(s) Summary
Core RPC Implementation
src/rpc/methods/eth.rs
Adds EthGetStorageAtV2 RpcMethod (uses ExtBlockNumberOrHash), introduces get_storage_at<DB>(...) helper that resolves actors, loads state, validates EVM actor, invokes GetStorageAt and pads results; refactors existing EthGetStorageAt to delegate to helper and adds DESCRIPTION metadata.
RPC Method Registry
src/rpc/mod.rs
Registers EthGetStorageAtV2 in the for_each_rpc_method macro under Eth RPC methods.
Tests
src/tool/subcommands/api_cmd/api_compare_tests.rs
Adds three tests invoking EthGetStorageAtV2 for epoch, safe, and finalized block references, mirroring existing V1 tests.
Test Snapshots
src/tool/subcommands/api_cmd/test_snapshots.txt
Adds three new RPC snapshot entries for the V2 tests.
Changelog
CHANGELOG.md
Adds an "Added" entry documenting implementation of Filecoin.EthGetStorageAt for API v2.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RPC as RPC Method (EthGetStorageAtV2)
    participant Chain as ChainStore/TipsetResolver
    participant State as ActorStateStore
    participant VM as VM/Invoker

    Client->>RPC: eth_getStorageAt(ethAddress, position, blockNumberOrHash)
    RPC->>Chain: tipset_by_block_number_or_hash_v2(...)
    Chain-->>RPC: Tipset
    RPC->>State: resolve actor address & load state
    State-->>RPC: ActorInfo / CodeCID
    RPC->>VM: GetStorageAt call (actor, position)
    VM-->>RPC: Call result or error
    RPC-->>Client: EthBytes (padded) or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • LesnyRumcajs
  • hanabi1224
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding V2 support for the Filecoin.EthGetStorageAt RPC method.
Linked Issues check ✅ Passed The pull request successfully implements the EthGetStorageAt RPC v2 method as required by issue #6301, with appropriate V2 infrastructure, tests, and documentation updates.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing EthGetStorageAt V2: new RPC variant, helper function refactoring, V2 tests, and documentation updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@sudo-shashank sudo-shashank marked this pull request as ready for review January 28, 2026 21:09
@sudo-shashank sudo-shashank requested a review from a team as a code owner January 28, 2026 21:09
@sudo-shashank sudo-shashank requested review from LesnyRumcajs and hanabi1224 and removed request for a team January 28, 2026 21:09
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 74.19355% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.73%. Comparing base (197805f) to head (22e2465).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/rpc/methods/eth.rs 74.19% 9 Missing and 7 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/mod.rs 24.35% <ø> (ø)
src/rpc/methods/eth.rs 69.55% <74.19%> (+0.24%) ⬆️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 197805f...22e2465. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

hanabi1224
hanabi1224 previously approved these changes Jan 29, 2026
@sudo-shashank sudo-shashank added this pull request to the merge queue Jan 29, 2026
@sudo-shashank sudo-shashank removed this pull request from the merge queue due to a manual request Jan 29, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/rpc/methods/eth.rs (1)

2540-2558: Avoid embedded newlines in the RPC description string.

The multiline literal includes a newline + indentation in the exposed description. Consider using concat! (and mirroring the same change in V2) to keep metadata clean.

🧹 Suggested formatting
-    const DESCRIPTION: Option<&'static str> = Some(
-        "Retrieves the storage value at a specific position for a contract
-        at a given block state, identified by its number, hash, or a special tag.",
-    );
+    const DESCRIPTION: Option<&'static str> = Some(concat!(
+        "Retrieves the storage value at a specific position for a contract ",
+        "at a given block state, identified by its number, hash, or a special tag.",
+    ));
🤖 Fix all issues with AI agents
In `@src/rpc/methods/eth.rs`:
- Around line 2590-2648: In get_storage_at, after deserializing
msg_rct.return_data() into ret, guard against ret.len() > EVM_WORD_LENGTH: if
greater, return an error (e.g. Err(anyhow::anyhow!("FVM returned >32 bytes for
storage slot").into())) instead of allowing oversized data through; locate the
check around the variable ret (created from
fvm_ipld_encoding::from_slice::<RawBytes>(...)?.bytes().to_vec()) and add the
length validation before padding/truncation logic so the function either errors
on oversized return data or explicitly truncates to EVM_WORD_LENGTH if you
prefer truncation.
🧹 Nitpick comments (1)
src/rpc/methods/eth.rs (1)

2561-2588: Add rustdoc for the new public RPC enum.

[recommendation] This keeps public API docs consistent and discoverable.

📝 Suggested doc comment
-pub enum EthGetStorageAtV2 {}
+/// RPC method: Filecoin.EthGetStorageAt (v2).
+pub enum EthGetStorageAtV2 {}

As per coding guidelines: Document all public functions and structs with rustdoc comments.

@sudo-shashank sudo-shashank added this pull request to the merge queue Jan 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 29, 2026
@sudo-shashank sudo-shashank added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit b2c3068 Jan 29, 2026
44 of 45 checks passed
@sudo-shashank sudo-shashank deleted the shashank/EthGetStorageAtV2 branch January 29, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RPC v2] Filecoin.EthGetStorageAt

3 participants